# @test in Pluto

**URL:** https://discourse.julialang.org/t/test-in-pluto/66831
**Category:** Pluto
**Tags:** testing
**Created:** [August 23, 2021, 9:22am UTC](https://discourse.julialang.org/t/test-in-pluto/66831 "2021-08-23T09:22:17Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![dpinol](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpinol/32/26550_2.png) [@dpinol](https://discourse.julialang.org/u/dpinol)
#### Post date: [August 23, 2021, 9:22am UTC](https://discourse.julialang.org/t/test-in-pluto/66831/1 "2021-08-23T09:22:17Z")

</div>

Hi has anybody tried to use @test from Pluto? I run into issues with both Pluto & PlutoTest

thanks

---

<div class="post-metadata">

### Author: ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)
#### Post date: [August 23, 2021, 11:24am UTC](https://discourse.julialang.org/t/test-in-pluto/66831/2 "2021-08-23T11:24:24Z")

</div>

PlutoTest works for me.  
Could you please post a MWE with the concrete error message?

---

<div class="post-metadata">

### Author: ![dpinol](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpinol/32/26550_2.png) [@dpinol](https://discourse.julialang.org/u/dpinol)
#### Post date: [August 23, 2021, 11:54am UTC](https://discourse.julialang.org/t/test-in-pluto/66831/3 "2021-08-23T11:54:05Z")

</div>

Sorry,  
I forgot to include the links about the issues:

- with Pluto & Test: [Values are not reported](https://github.com/fonsp/Pluto.jl/issues/1406)
- with PlutoTest: [“not defined” error when variable within a loop](https://github.com/JuliaPluto/PlutoTest.jl/discussions/7)

thanks

---

<div class="post-metadata">

### Author: ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)
#### Post date: [August 23, 2021, 1:37pm UTC](https://discourse.julialang.org/t/test-in-pluto/66831/4 "2021-08-23T13:37:37Z")

</div>

Looks like PlutoTest `@test` is not recognizing the local scope of the for loop (`a` is not defined as global variable, but only inside the for loop). When using `@test` outside of the for-loop it works.  
I suggest to create an Issue at PlutoTest.

Regarding Test (not PlutoTest), the behavior in Pluto is probably the expected behavior - `@test` just raises an exception. To get a description of the successful and failed test cases wrap it in `@testset`.

---

<div class="post-metadata">

### Author: ![dpinol](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpinol/32/26550_2.png) [@dpinol](https://discourse.julialang.org/u/dpinol)
#### Post date: [August 23, 2021, 2:48pm UTC](https://discourse.julialang.org/t/test-in-pluto/66831/5 "2021-08-23T14:48:53Z")

</div>

hi

> I suggest to create an Issue at PlutoTest.  
> yes, ["not defined" error when variable within a loop · JuliaPluto/PlutoTest.jl · Discussion #7 · GitHub](https://github.com/JuliaPluto/PlutoTest.jl/discussions/7)

> To get a description of the successful and failed test cases wrap it in `@testset` .

See [@test to display the tested values · Issue #1406 · fonsp/Pluto.jl · GitHub](https://github.com/fonsp/Pluto.jl/issues/1406#issuecomment-903842305)
